/*
 * NetworkManager.java
 *    Author: nfk
 *      Date: Sep 19, 2008
 *      
 *   I'faces:
 *      NetworkManager
 */

package at.syncme.framework.midp;


import java.io.IOException;

import at.syncme.framework.Event;


/**
 * An basic interface for network managers.
 * @author nfk
 */
public interface NetworkManager {

    /**
     * Forces the client/server to drop all connections (and possibly shutdown listeners).
     */
    public void disconnect();
    

    /**
     * Sends specified event to the output stream(s).
     * @param e the event to send
     * @throws NullPointerException if s is null
     * @throws IOException if any network error occurs
     * @throws IllegalStateException if no output stream is available
     */
    public void send(final Event e) throws IOException;


    /**
     * Receives a new event on the input stream(s).
     * @return the new line
     * @throws IOException if any network error occurs
     * @throws IllegalStateException if no input stream is available
     */
    public Event receive() throws IOException;


//    /**
//     * Specifies the event listener which handles incoming strings.
//     * @param listener the event listener
//     * @throws NullPointerException if listener is null
//     */
//    public void setEventListener(final EventGenerator listener);

}

/* End of NetworkManager.java */
